package com.kbbywyclient.service;

import android.support.annotation.NonNull;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by Jiangzx on 2017/10/18 16:19.
 */

public class ApiServiceHelper{
    /**
     * 指定observable运行线程，请求在io线程，回调在ui线程
     * @param observable observable
     * @return 指定线程后的observable
     */
    public static synchronized <T>Observable<T> appointThreadNormal(@NonNull Observable<T> observable){
        return observable.
                subscribeOn(Schedulers.io()).
                observeOn(AndroidSchedulers.mainThread());
    }
}
